package com.tuyrt.`as`.proj.main.route

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.tuyrt.`as`.proj.main.R
import com.tuyrt.hi.ui.empty.EmptyView
import kotlinx.android.synthetic.main.activity_login.*

/**
 * author: Administrator on 2021/6/8.
 * desc:
 */
@Route(path = "/degrade/global/activity")
class DegradeGlobalActivity : AppCompatActivity() {

    @JvmField
    @Autowired
    var degrade_title: String? = null

    @JvmField
    @Autowired
    var degrade_desc: String? = null

    @JvmField
    @Autowired
    var degrade_action: String? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        HiRoute.inject(this)

        setContentView(R.layout.activity_degrade_global)

        val emptyView = findViewById<EmptyView>(R.id.empty_view)
        emptyView.setIcon(R.string.if_empty)

        if (degrade_title != null) {
            emptyView.setTitle(degrade_title!!)
        }

        if (degrade_desc != null) {
            emptyView.setDesc(degrade_desc!!)
        }

        if (degrade_action != null) {
            emptyView.setHelpAction(listener = {
                startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(degrade_action)))
            })
        }

        action_back.setOnClickListener { onBackPressed() }
    }
}